package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.TenderSuppliers;
import com.ruoyi.system.mapper.TenderSuppliersMapper;
import com.ruoyi.system.service.ITenderSuppliersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.ruoyi.common.utils.ShiroUtils.getLoginName;

/**
 * 供应商信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-12
 */
@Service
public class TenderSuppliersServiceImpl implements ITenderSuppliersService 
{
    @Autowired
    private TenderSuppliersMapper tenderSuppliersMapper;

    /**
     * 查询供应商信息
     * 
     * @param supplierId 供应商信息主键
     * @return 供应商信息
     */
    @Override
    public TenderSuppliers selectTenderSuppliersBySupplierId(Long supplierId)
    {
        return tenderSuppliersMapper.selectTenderSuppliersBySupplierId(supplierId);
    }

    /**
     * 查询供应商信息列表
     * 
     * @param tenderSuppliers 供应商信息
     * @return 供应商信息
     */
    @Override
    public List<TenderSuppliers> selectTenderSuppliersList(TenderSuppliers tenderSuppliers)
    {
        return tenderSuppliersMapper.selectTenderSuppliersList(tenderSuppliers);
    }

    /**
     * 新增供应商信息
     * 
     * @param tenderSuppliers 供应商信息
     * @return 结果
     */
    @Override
    public int insertTenderSuppliers(TenderSuppliers tenderSuppliers)
    {
        tenderSuppliers.setCreator(getLoginName());
        return tenderSuppliersMapper.insertTenderSuppliers(tenderSuppliers);
    }

    /**
     * 修改供应商信息
     * 
     * @param tenderSuppliers 供应商信息
     * @return 结果
     */
    @Override
    public int updateTenderSuppliers(TenderSuppliers tenderSuppliers)
    {
        tenderSuppliers.setUpdateTime(DateUtils.getNowDate());
        tenderSuppliers.setUpdater(getLoginName());
        return tenderSuppliersMapper.updateTenderSuppliers(tenderSuppliers);
    }

    /**
     * 批量删除供应商信息
     * 
     * @param supplierIds 需要删除的供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteTenderSuppliersBySupplierIds(String supplierIds)
    {
        return tenderSuppliersMapper.deleteTenderSuppliersBySupplierIds(Convert.toStrArray(supplierIds));
    }

    /**
     * 删除供应商信息信息
     * 
     * @param supplierId 供应商信息主键
     * @return 结果
     */
    @Override
    public int deleteTenderSuppliersBySupplierId(Long supplierId)
    {
        return tenderSuppliersMapper.deleteTenderSuppliersBySupplierId(supplierId);
    }

    @Override
    public List<TenderSuppliers> selectTenderSuppliersAll() {
        return tenderSuppliersMapper.selectTenderSuppliersAll();
    }
}
